﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery-ui-1.8.1.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
<script src="js/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-cn.js" type="text/javascript"></script>
<script src="js/json2.js" type="text/javascript"></script>
<script type="text/javascript" src="js/WdatePicker.js"></script>
<script type="text/javascript">
	$.jgrid.no_legacy_api = true;
	$.jgrid.useJSON = true;
</script>
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script type="text/javascript">
function searchFlow() {
	var company = $("#sf_company").val();
	var wname = $.trim($("#sf_wname").val());
	var sdate = $.trim($("#sf_startdate").val());
	var edate = $.trim($("#sf_enddate").val());
	var cid   = $.trim($("#sf_cid").val());
	var cname = $.trim($("#sf_cname").val());
	var ctype = $("#sf_ctype").val();
	
	if ((sdate.length + edate.length) == 8) {
		alert("必须同时选择起始时间和结束时间！");
		return;
	}
  var q = "action=7&comid=" + company + "&wname=" + escape(wname)+ "&ctype=" + ctype + "&cid=<" + cid + ">&cname=" + escape(cname);
	if ((sdate.length == 8) && (edate.length == 8))
		q += "&recdate=[" + sdate + "," + edate + "]";
	jQuery("#list1").jqGrid('setGridParam',{page:1,url:"main?" + q}).trigger("reloadGrid");
};

function initCompany() {
	$.get('main?action=14',function (data, textStatus) {
		var ops = data;
		var len = ops.length;
		$("#sf_company").html("<option value='0'>全  部</option>" + ops.substring(8, len - 9));
	});
};

function setGrid() {
	jQuery("#list1").jqGrid({
			url:'main?action=7',
			datatype: "json",
			hidegrid: "false",
			colNames:['流水号','客户编号','客户姓名','客户类型','任务编号','性别','服务类型','所属区','原余额','现余额','账户消费','现金消费','服务人员','服务公司','发生日期','时间戳'], 
			colModel:[ 
					{name:'flowid', width:60, sortable:false,align:"right"},
					{name:'cid', width:120, sortable:false,align:"right"},
					{name:'cname', width:80, sortable:false, align:"right"},
					{name:'ctype',width:80, sortable:false, align:"right",formatter:'select', editoptions:{value:"1:三无老人;2:70岁低保;3:85岁高龄;4:70岁优抚;5:70岁劳模"}},
					{name:'taskid', width:80, sortable:false, align:"right"},
					{name:'csex',width:60, sortable:false, align:"right",formatter:'select', editoptions:{value:"F:女;M:男"}},
					{name:'cservice',width:100, sortable:false, align:"right",formatter:'select',editoptions:{value:"0:新居开荒;1:家居保洁;2:办公室保洁;3:管道疏通;4:家电维修;5:电脑维修;6:装饰装修;7:家政服务;8:家教服务;9:票务服务;10:配送服务;11:搬家服务;12:开锁服务;13:房屋维修;14:其他"}},
					{name:'district',width:100, sortable:false, align:"right",formatter:'select',editoptions:{value:"1:市辖区;2:桥东区;3:桥西区;4:高新区;5:宣化区;6:下花园区"}},
					{name:'oldsum', width:60, sortable:false, align:"right"},
					{name:'cursum', width:60, sortable:false, align:"right"},
					{name:'consume', width:60, sortable:false, align:"right"},
					{name:'cash', width:60, sortable:false, align:"right"},
					{name:'wname', width:60, sortable:false, align:"right"},
					{name:'comid', width:120, sortable:false, align:"right",hidden:true},
					{name:'recdate', width:90, sortable:false, align:"right"},
					{name:'rectime', width:140, sortable:false, align:"right"}
			], 
			viewrecords: true,
			rowNum:20,
			height: 480,
			pager: '#gridpager',
			caption:"查看流水"
	})};
	
	$(document).ready(function(){
		setGrid();
		initCompany();
		$("#sf_submit").click(searchFlow);
	});
</script>
<body style="background-color:#4e84c0;">

                	<form id="sf" action="main">
                	<table>
                	<tr>
                		<td width="36">起始日期</td><td width="100"><input id="sf_startdate" name="sf_recdate" type="text" text="" size=10 onClick="WdatePicker({dateFmt:'yyyyMMdd'})" /></td>
                		<td width="36">结束日期</td><td><input id="sf_enddate" name="sf_enddate" type="text" text="" size=10 onClick="WdatePicker({dateFmt:'yyyyMMdd'})" /></td>
                		<td width="36">服务公司</td><td width="100"><select id="sf_company" name="sf_company"><option value='0'>全  部</option></select></td>
                		<td width="36">人员类型</td>
                                <td><select id="sf_ctype" name="sf_ctype">
                								<option value="0">全  部</option>
			                					<option value="1">三无老人</option>
			                					<option value="2">70岁低保</option>
			                					<option value="3">85岁高龄</option>
			                					<option value="4">70岁优抚</option>
			                					<option value="5">70岁劳模</option>
                				</select></td>
                		<td width="90">客户编号(*)</td><td><input id="sf_cid" name="sf_cid" type="text" text=""  size="15"/></td>
                		<td width="36">客户姓名</td><td><input id="sf_cname" name="sf_cname" type="text" text="" size="10" /></td>
                		<td width="36">服务人员</td><td><input type="text" id="sf_wname" name="sf_wname" size="10"/></td>
                		<td align="right"><input type="button" id="sf_submit" value="查 询"></td>
                	</tr>
                	</table>
                	</form>
           
				<div id="RightPane"" >
					<div class="innertube">
					<table id="list1"></table>
					<div id="gridpager"></div>
					</div>
				</div>
</body>
